projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7027d56
)
cfi_flash: precision and underflow problem in tout calculation
author
Renato Andreola
<
[email protected]
>
Wed, 24 Mar 2010 15:00:47 +0000
(23:00 +0800)
committer
Stefan Roese
<
[email protected]
>
Thu, 25 Mar 2010 08:44:58 +0000
(09:44 +0100)
With old configuration it could happen tout=0 if CONFIG_SYS_HZ<1000.
Signed-off-by: Renato Andreola <
[email protected]
>
Signed-off-by: Alessandro Rubini <
[email protected]
>
Signed-off-by: Thomas Chou <
[email protected]
>
Signed-off-by: Stefan Roese <
[email protected]
>
drivers/mtd/cfi_flash.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/cfi_flash.c
b/drivers/mtd/cfi_flash.c
index fdba297c88b075cbc098b6a92fa474a2f8c54d65..cd1a86ebad27c734a2e1d99705dae8196d7f9c43 100644
(file)
--- a/
drivers/mtd/cfi_flash.c
+++ b/
drivers/mtd/cfi_flash.c
@@
-537,7
+537,10
@@
static int flash_status_check (flash_info_t * info, flash_sect_t sector,
ulong start;
#if CONFIG_SYS_HZ != 1000
- tout *= CONFIG_SYS_HZ/1000;
+ if ((ulong)CONFIG_SYS_HZ > 100000)
+ tout *= (ulong)CONFIG_SYS_HZ / 1000; /* for a big HZ, avoid overflow */
+ else
+ tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000);
#endif
/* Wait for command completion */